<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta http-equiv="X-UA-Compatible" content="ie=edge">
  <title>Document</title>
  <style>
    * {
      margin: 0;
      padding: 0;
    }
    /* html,body{
      height:2000px;
    } */
    ul, li {
      list-style: none;
    }
    ul {
      width: 1200px;
      display: flex;
      flex-wrap: wrap;
      margin: 0 auto;
      justify-content: space-between;
      padding-top: 10px;
    }

    li {
      width: 290px;
      border: 1px solid #333;
      margin-bottom: 10px;
      padding: 5px;
      box-sizing: border-box;
    }

    li > img {
      width: 278px;
      display: block;
    }
    header {
      height: 200px;
      background-color: cadetblue;
      text-align: center;
      line-height: 200px;
      font-size: 50px;
    }
    .tips{
      position: fixed;
      bottom:0; 
      left:0; right:0;
      margin: auto;
      width: 300px;
      height: 100px;
      background: rgba(154, 205, 50, 0.5);
      text-align: center;
      line-height: 100px;
      font-size: 50px;
      display: none;
    }
  </style>
</head>
<body>
  <header>顶部内容</header>
  <ul>
  
    <!-- <li>
      <img src="https://img.alicdn.com/bao/uploaded/https://img.alicdn.com/imgextra/i3/2251059038/O1CN01zJEpaN2GdSG1Xvo8y_!!2251059038.jpg" alt="">
      <p>音乐节名称</p>
      <p>城市: xx</p>
      <p>地址: xx</p>
      <p>价格: xx</p>
      <p>时间: xx</p>
    </li>  -->
  </ul>
  <div class="tips">已加载完毕</div>
</body>
</html>
<script src="./dm_list.js"></script>
<script>
    const ul = document.querySelector("ul");
    const tip = document.querySelector(".tips");
    function fn(){
      const arr = list.splice(0,8);
        for(let i=0;i<arr.length;i++){
            const li = document.createElement("li");
            li.innerHTML = 
            `<img src="${arr[i].pic}" alt="">
            <p>音乐节名称: ${arr[i].name}</p>
            <p>城市: ${arr[i].city}</p>
            <p>地址: ${arr[i].address}</p>
            <p>价格: ${arr[i].price}</p>
            <p>时间: ${arr[i].showTime}</p>` 
            ul.appendChild(li);
        }                
    }
    fn();
    window.addEventListener("scroll",()=>{
      let length = document.body.scrollTop || document.documentElement.scrollTop;
      let height = document.body.scrollHeight || document.documentElement.scrollHeight;
      if(length>height/3){
        fn();
      }
      if(length+window.innerHeight>height){
        tip.style.display = "block";
      }else{
        tip.style.display = "none";
      }
    }); 
</script>